<script setup lang='ts'>
import { onMounted, ref } from 'vue';

  // 1. 创建一个ref对象
  const myInRef = ref(null)
  onMounted(()=>{
    // myInRef.value.focus()
    console.log(myInRef.value);
  })

  const btnRef = ref(null)
  console.log(btnRef.value);
  
  // onMounted(()=>{
  //   btnRef.value.focus()
  // })

  const clikeMe = () =>{
    myInRef.value.focus()
  }
</script>
  
<template>
  <div>
    <input ref="myInRef" type="text">
    <button ref="btnRef" @click="clikeMe">点我</button>
  </div> 
</template>
  
<style scoped>
  
</style>